package com.ruoyi.net.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.net.domain.BusiL2VpnNodeInfo;
import com.ruoyi.net.domain.BusiL2VpnNodeInfoListVo;
import com.ruoyi.net.mapper.BusiL2VpnNodeInfoMapper;
import com.ruoyi.net.service.IBusiL2VpnNodeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务-L2 VPN配置-节点属性-节点信息Service业务层处理
 * 
 * @author tony
 * @date 2024-12-14
 */
@Service
public class BusiL2VpnNodeInfoServiceImpl implements IBusiL2VpnNodeInfoService 
{
    @Autowired
    private BusiL2VpnNodeInfoMapper busiL2VpnNodeInfoMapper;

    /**
     * 查询业务-L2 VPN配置-节点属性-节点信息
     * 
     * @param id 业务-L2 VPN配置-节点属性-节点信息主键
     * @return 业务-L2 VPN配置-节点属性-节点信息
     */
    @Override
    public BusiL2VpnNodeInfo selectBusiL2VpnNodeInfoById(String id)
    {
        return busiL2VpnNodeInfoMapper.selectBusiL2VpnNodeInfoById(id);
    }

    /**
     * 查询业务-L2 VPN配置-节点属性-节点信息列表
     * 
     * @param busiL2VpnNodeInfo 业务-L2 VPN配置-节点属性-节点信息
     * @return 业务-L2 VPN配置-节点属性-节点信息
     */
    @Override
    public List<BusiL2VpnNodeInfoListVo> selectBusiL2VpnNodeInfoList(BusiL2VpnNodeInfo busiL2VpnNodeInfo)
    {
        return busiL2VpnNodeInfoMapper.selectBusiL2VpnNodeInfoList(busiL2VpnNodeInfo);
    }

    /**
     * 新增业务-L2 VPN配置-节点属性-节点信息
     * 
     * @param busiL2VpnNodeInfo 业务-L2 VPN配置-节点属性-节点信息
     * @return 结果
     */
    @Override
    public int insertBusiL2VpnNodeInfo(BusiL2VpnNodeInfo busiL2VpnNodeInfo)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(busiL2VpnNodeInfo.getId())) {
            busiL2VpnNodeInfo.setId(uuid);
        }
        busiL2VpnNodeInfo.setCreateBy(SecurityUtils.getUsername());
        busiL2VpnNodeInfo.setCreateTime(DateUtils.getNowDate());
        busiL2VpnNodeInfo.setUpdateBy(SecurityUtils.getUsername());
        busiL2VpnNodeInfo.setUpdateTime(DateUtils.getNowDate());
        return busiL2VpnNodeInfoMapper.insertBusiL2VpnNodeInfo(busiL2VpnNodeInfo);
    }

    /**
     * 修改业务-L2 VPN配置-节点属性-节点信息
     * 
     * @param busiL2VpnNodeInfo 业务-L2 VPN配置-节点属性-节点信息
     * @return 结果
     */
    @Override
    public int updateBusiL2VpnNodeInfo(BusiL2VpnNodeInfo busiL2VpnNodeInfo)
    {
        busiL2VpnNodeInfo.setUpdateBy(SecurityUtils.getUsername());
        busiL2VpnNodeInfo.setUpdateTime(DateUtils.getNowDate());
        return busiL2VpnNodeInfoMapper.updateBusiL2VpnNodeInfo(busiL2VpnNodeInfo);
    }

    /**
     * 批量删除业务-L2 VPN配置-节点属性-节点信息
     * 
     * @param ids 需要删除的业务-L2 VPN配置-节点属性-节点信息主键
     * @return 结果
     */
    @Override
    public int deleteBusiL2VpnNodeInfoByIds(String[] ids)
    {
        return busiL2VpnNodeInfoMapper.deleteBusiL2VpnNodeInfoByIds(ids);
    }

    /**
     * 删除业务-L2 VPN配置-节点属性-节点信息信息
     * 
     * @param id 业务-L2 VPN配置-节点属性-节点信息主键
     * @return 结果
     */
    @Override
    public int deleteBusiL2VpnNodeInfoById(String id)
    {
        return busiL2VpnNodeInfoMapper.deleteBusiL2VpnNodeInfoById(id);
    }
}
